﻿using System;
using UnityEngine;

// Token: 0x02000023 RID: 35
public class PlayerInput : MonoBehaviour
{
	// Token: 0x060000A1 RID: 161 RVA: 0x0000EEA5 File Offset: 0x0000D0A5
	private void Start()
	{
		this.body = base.GetComponent<BodyScript>();
		this.debugCode[0] = KeyCode.Alpha1;
		this.debugCode[1] = KeyCode.Alpha9;
		this.debugCode[2] = KeyCode.Alpha8;
		this.debugCode[3] = KeyCode.Alpha4;
	}

	// Token: 0x060000A2 RID: 162 RVA: 0x0000EEDC File Offset: 0x0000D0DC
	private void Update()
	{
		this.body.moveDir.x = Input.GetAxisRaw("Horizontal");
		this.body.lookingPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
		this.laughTime -= Time.deltaTime;
		if (Input.GetKeyDown(KeyCode.Alpha1) && this.laughTime < 0f)
		{
			this.laughTime = 1f;
			if (this.body.GetComponent<VoiceScript>())
			{
				this.body.GetComponent<VoiceScript>().Cheer();
			}
			if (this.body.GetComponent<GruntText>())
			{
				this.body.GetComponent<GruntText>().Say(this.body.GetComponent<GruntText>().killLines[Random.Range(0, this.body.GetComponent<GruntText>().killLines.Count)], 3, 2f);
			}
		}
		if (Input.GetMouseButtonDown(1))
		{
			this.body.isBlocking = true;
			this.body.TryPerfectBlock();
		}
		if (Input.GetMouseButtonUp(1))
		{
			this.body.isBlocking = false;
		}
		if (Input.GetMouseButtonDown(0))
		{
			this.body.Attack();
		}
		if (Input.GetMouseButtonUp(0))
		{
			this.body.StopAttack();
		}
		if (Input.GetKeyDown(KeyCode.Space))
		{
			this.body.Jump();
		}
		if (Input.GetKeyDown(KeyCode.V))
		{
			if (!this.body.holdingMain)
			{
				this.body.Pickup(null);
			}
			else
			{
				this.body.DropWeapon();
			}
		}
		if (Input.GetKeyDown(KeyCode.F))
		{
			this.body.ThrowWeapon();
		}
		if (Input.GetMouseButtonDown(2))
		{
			this.body.Shove();
		}
		if (Input.GetKey(KeyCode.Delete) && Input.GetKey(KeyCode.Space))
		{
			GameManager.main.ResetProgress();
			GameManager.main.fadingOut = true;
		}
		if (this.debugMode)
		{
			if (Input.GetKey(KeyCode.End) && Input.GetKeyDown(KeyCode.Space))
			{
				PlayerPrefs.SetInt("up1", 25);
				PlayerPrefs.SetInt("up2", 25);
				PlayerPrefs.SetInt("up3", 25);
				PlayerPrefs.SetInt("up4", 25);
				PlayerPrefs.SetInt("up5", 25);
				PlayerPrefs.SetInt("highScore", 100);
			}
			if (Input.GetKey(KeyCode.End) && Input.GetKeyDown(KeyCode.A))
			{
				PlayerPrefs.SetInt("up1", PlayerPrefs.GetInt("up1") + 3);
				PlayerPrefs.SetInt("up2", PlayerPrefs.GetInt("up2") + 3);
				PlayerPrefs.SetInt("up3", PlayerPrefs.GetInt("up3") + 3);
				PlayerPrefs.SetInt("up4", PlayerPrefs.GetInt("up4") + 3);
				PlayerPrefs.SetInt("up5", PlayerPrefs.GetInt("up5") + 3);
				PlayerPrefs.SetInt("highScore", 100);
			}
			if (Input.GetKey(KeyCode.End) && Input.GetKeyDown(KeyCode.W))
			{
				GameManager.main.waveNumber = 99f;
			}
			if (Input.GetKey(KeyCode.End) && Input.GetKeyDown(KeyCode.O))
			{
				GameManager.main.sceneLoadTarget = "OriginSelect";
				GameManager.main.fadingOut = true;
			}
		}
		if (Input.GetKey(KeyCode.X) && this.body.fallTime < 1f)
		{
			this.body.fallTime = 1f;
		}
		if (Input.GetKeyDown(KeyCode.LeftShift))
		{
			this.body.Dodge();
		}
		if (Input.GetKeyDown(this.debugCode[this.sequenceIndex]))
		{
			int num = this.sequenceIndex + 1;
			this.sequenceIndex = num;
			if (num == this.debugCode.Length)
			{
				this.sequenceIndex = 0;
				this.debugMode = true;
				return;
			}
		}
		else if (Input.anyKeyDown)
		{
			this.sequenceIndex = 0;
		}
	}

	// Token: 0x0400017A RID: 378
	public BodyScript body;

	// Token: 0x0400017B RID: 379
	private float laughTime;

	// Token: 0x0400017C RID: 380
	private KeyCode[] debugCode = new KeyCode[4];

	// Token: 0x0400017D RID: 381
	private int sequenceIndex;

	// Token: 0x0400017E RID: 382
	private bool debugMode;
}
